/**  
 * @project_name y_comm
 * @Title: CashoutModel.java
 * @Package com.yjd.comm.cahout
 * @Description: TODO
 * @author lindy lindytem@126.com  
 * @date 2014-11-5 上午10:58:28
 * @version V1.0  
 * <b>Copyright (c)</b> 2014医信金融信息服务（上海）有限公司-版权所有<br/>
 */
package com.yjd.comm.funds.model;

import java.text.DecimalFormat;

import com.yjd.comm.base.model.Model;
import com.yjd.comm.enums.FundsDataRefTableEnum;
import com.yjd.comm.system.enums.DictTypeEnum;
import com.yjd.comm.system.util.DictUtil;
import com.yjd.comm.util.DateUtil;

/**
 * @ClassName: CashoutModel
 * @Description: TODO
 * @author lindy lindytem@126.com
 * @date 2014-11-5 上午10:58:28
 */
public class FundsDataModel extends Model {

	/**
	 * @Fields serialVersionUID : TODO
	 */
	private static final long serialVersionUID = -1091882089882799664L;
	
	private Integer id;// 内部ID
	private Long user_id;// 用户号
	private Double price;// 金额
	private Double balance;// 余额
	private Integer income;// 标志位
	private Integer type;// 交易类型
	private Long uptime;// 更新
	private Double reward;//红包
	private Double volume;//代金券
	
	private String linkName;
	private String priceShow;
	private String balanceShow;
	private String uptimeShow;// 更新
	//关联对象id
	private Long ref_id;
	//关联对象类型
	private Integer ref_table;
	//父分类
	private Integer p_type;
	
	
	

	public String getLinkName() {
		return linkName;
	}

	public void setLinkName(String linkName) {
		this.linkName = linkName;
	}

	public String getPriceShow() {
		if( price!=null){
			DecimalFormat myformat = new DecimalFormat();
			myformat.applyPattern("###,##0.00");
			return myformat.format(price);
		}
		
		return priceShow;
	}

	public void setPriceShow(String priceShow) {
		this.priceShow = priceShow;
	}

	public String getBalanceShow() {
		if( balance!=null){
			DecimalFormat myformat = new DecimalFormat();
			myformat.applyPattern("###,##0.00");
			return myformat.format(balance);
		}
		return balanceShow;
	}

	public void setBalanceShow(String balanceShow) {
		this.balanceShow = balanceShow;
	}

	public String getUptimeShow() {
		return uptimeShow;
	}

	public void setUptimeShow(String uptimeShow) {
		this.uptimeShow = uptimeShow;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Long getUser_id() {
		return user_id;
	}

	public void setUser_id(Long user_id) {
		this.user_id = user_id;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	public Integer getIncome() {
		return income;
	}

	public void setIncome(Integer income) {
		this.income = income;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Long getUptime() {
		return uptime;
	}

	public void setUptime(Long uptime) {
		this.uptime = uptime;
	}
	
	public Double getReward() {
		return reward;
	}

	public void setReward(Double reward) {
		this.reward = reward;
	}

	public Double getVolume() {
		return volume;
	}

	public void setVolume(Double volume) {
		this.volume = volume;
	}

	public FundsDataModel() {
	}

	public FundsDataModel(Long user_id, Double price, Double balance,
			Integer income, Integer type, Long uptime,Long ref_id,FundsDataRefTableEnum ref_table,Integer p_type) {
		this.user_id = user_id;
		this.price = price;
		this.balance = balance;
		this.income = income;
		this.type = type;
		this.uptime = uptime;
		this.ref_id = ref_id;
		if(ref_table!=null){
			this.ref_table = ref_table.getValue();
		}
		this.p_type = p_type;
	}
	
	public FundsDataModel(Long user_id, Double price, Double balance,
			Integer income, Integer type, Long uptime,Double reward,Double volume,Long ref_id,FundsDataRefTableEnum ref_table,Integer p_type) {
		this.user_id = user_id;
		this.price = price;
		this.balance = balance;
		this.income = income;
		this.type = type;
		this.uptime = uptime;
		this.reward =reward;
		this.volume = volume;
		this.ref_id = ref_id;
		if(ref_table!=null){
			this.ref_table = ref_table.getValue();
		}
		this.p_type = p_type;
	}

	public void setStrMap() throws Exception{
		this.getStrMap().put(
				"uptime",
				DateUtil.timestampToDateString(new Long(this.getUptime()),
						DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
		this.getStrMap().put(
				"type",
				DictUtil.getDictDescByCode(DictTypeEnum.acct_record_type, this.getType()));
		this.getStrMap().put(
				"income",this.getIncome()>0?"+":this.getIncome()<0?"-":"=");
	}

	public Long getRef_id() {
		return ref_id;
	}

	public void setRef_id(Long ref_id) {
		this.ref_id = ref_id;
	}

	public Integer getRef_table() {
		return ref_table;
	}

	public void setRef_table(Integer ref_table) {
		this.ref_table = ref_table;
	}

	public Integer getP_type() {
		return p_type;
	}

	public void setP_type(Integer p_type) {
		this.p_type = p_type;
	}

}
